package com.lantosec.hmrp.modules.monitor.controller;


import com.lantosec.hmrp.core.kit.Result;
import com.lantosec.hmrp.core.mvc.BaseController;
import com.lantosec.hmrp.modules.monitor.entity.VisitEntity;
import com.lantosec.hmrp.modules.monitor.entity.VisitRecordDetailsEntity;
import com.lantosec.hmrp.modules.monitor.entity.VisitRecordEntity;
import com.lantosec.hmrp.modules.monitor.service.IMonitorVisitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 大屏患者回访监控控制器
 *
 * @author AutoCode
 * @since 2020-05-27
 */
@Api(value = "大屏患者回访监控控制器", tags = "大屏患者回访监控控制器")
@RestController
@RequestMapping("/monitor/visit")
@Log4j2
public class MonitorVisitController extends BaseController {

    @Autowired
    private IMonitorVisitService service;

    @GetMapping("getVisitRank")
    @ApiOperation(value = "医生回访排名")
    public Result<List<VisitEntity>> getVisitRank(
            @ApiParam(value = "月份") @RequestParam(name = "month", required = false) String month,
            @ApiParam(value = "年份") @RequestParam(name = "year", required = false) String year
    ) {
        List<VisitEntity> param = service.getVisitRank(month, year);
        return Result.ok(param);
    }

    @GetMapping("getVisitRecord")
    @ApiOperation(value = "查看某个医生的回访记录")
    public Result<List<VisitRecordEntity>> getVisitRecord(
            @ApiParam(value = "月份") @RequestParam(name = "month", required = false) String month,
            @ApiParam(value = "年份") @RequestParam(name = "year", required = false) String year,
            @ApiParam(value = "用户id") @RequestParam(name = "userId") String userId
    ) {
        List<VisitRecordEntity> param = service.getVisitRecord(month, year,userId);
        return Result.ok(param);
    }

    @GetMapping("getVisitRecordDetails")
    @ApiOperation(value = "查看回访记录详情")
    public Result<List<VisitRecordDetailsEntity>> getVisitRecordDetails(
            @ApiParam(value = "月份") @RequestParam(name = "month", required = false) String month,
            @ApiParam(value = "年份") @RequestParam(name = "year", required = false) String year,
            @ApiParam(value = "用户id") @RequestParam(name = "userId") String userId,
            @ApiParam(value = "回访任务ID") @RequestParam(name = "revisitTaskId") String revisitTaskId
    ) {
        List<VisitRecordDetailsEntity> param = service.getVisitRecordDetails(month,year,userId,revisitTaskId);
        return Result.ok(param);
    }
}
